镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix: fix space at end of table line - #2201

Merged
UziTech merged 1 commit into
markedjs:masterfrom
UziTech:table-space
Sep 8, 2021
Merged

UziTech merged 1 commit into
markedjs:masterfrom
UziTech:table-space

Conversation

@UziTech

@UziTech UziTech commented Sep 7, 2021

Copy link
Copy Markdown
Member

Marked version: v3.0.2

Markdown flavor: GFM

Description

Fix ignore space after table line.

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

In most cases, this should be a different person than the contributor.

@vercel

vercel Bot commented Sep 7, 2021 •

Copy link
Copy Markdown

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/markedjs/markedjs/JCHBvjnQaXpBPM9gTPAUNRsX7dhN
✅ Preview: https://markedjs-git-fork-uzitech-table-space-markedjs.vercel.app

@calculuschild

calculuschild commented Sep 8, 2021 •

Copy link
Copy Markdown
Contributor

Edit: Bwahahahaha. Disregard. I misread the regex so this is all fine. Approved.

This solves the immediate problem, but I wanted to run a couple thoughts by you guys in case there is a deeper issue we should handle in following the (vague) GFM Spec:

  1. Leading and trailing pipes | are not required on table rows. We currently don't allow for this on the delimiter row but perhaps we should for consistency with other cells, since I don't see anything in the Spec that says delimiter rows are exempted from this rule.
  2. The spec says: "The delimiter row consists of cells whose only content are hyphens (-), and optionally, a leading or trailing colon (:), or both". However, it also says: "Spaces between pipes and cell content are trimmed." That is: trailing and leading spaces are not counted as part of the cell content. This indicates to me that a delimiter cell | :----: | should be a valid delimiter, since the cell's only content is :----: ; the spaces are trimmed and not considered part of the content. Edit: Looks like we already handle this one; I didn't realize.

If these are both true, then we might further adjust this PR to handle not just ending spaces, but also ending without a pipe at all.

So this would be a valid table:

a  |  b 
-- | -- 
c  |  d

And it works in Github:

a b
c d

But we currently can't handle it.

@UziTech
UziTech merged commit 910f0f0 into markedjs:master Sep 8, 2021
@UziTech
UziTech deleted the table-space branch September 8, 2021 20:20
github-actions Bot pushed a commit that referenced this pull request Sep 8, 2021
## [3.0.3](v3.0.2...v3.0.3) (2021-09-08)

### Bug Fixes

* fix space at end of table line ([#2201](#2201)) ([910f0f0](910f0f0))
@github-actions

github-actions Bot commented Sep 8, 2021

Copy link
Copy Markdown

🎉 This PR is included in version 3.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Logiclayer1111 pushed a commit to Logiclayer1111/marked that referenced this pull request Apr 20, 2026
## [3.0.3](markedjs/marked@v3.0.2...v3.0.3) (2021-09-08)

### Bug Fixes

* fix space at end of table line ([#2201](markedjs/marked#2201)) ([e3a72d5](markedjs/marked@e3a72d5))

This branch was successfully deployed

1 active deployment
Preview — cb9c44aa Deployed Sep 7, 2021 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trailing whitespace at the end of table delimiter row breaks table rendering

3 participants